<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<script>
    let arr = [11,22,33,44,55,66];
    <!--(item>50?1:0),0 最后一个0表示给sum一个初始值-->
    let num = arr.reduce((sum,item) => sum + (item>50?1:0),0);
    /**相当于
     let sum = 0;
     arr.forEach(item => {
        sum += (item > 50 ? 1 : 0);
    })
     */
    console.log(num);


</script>
</body>
</html>